#ifndef _ESP8266_H_
#define _ESP8266_H_
#include "Uart.h"
#include "data.h"

typedef enum
{
    ESPREC_OK,
    ESPREC_ERR

} ESP_RES_T;
typedef enum
{
    ERRCMD,
    SETCONFIG,
    SETWARN,
    CONTROLDEVICE,
    GETCURDATA
} INSTRUCT_T;

typedef u8 (*pEspConnect)(void);
typedef u8 (*pEspEmergencyMeasure)(T_DATA);
typedef u8 (*pEspUpLoadData)(T_DATA);
typedef u8 (*pEspConnectDeinit)(void);
typedef u8 (*pEspEheckWifiRxBuff)(void);
typedef void (*pEspReadWarnConfig)(void);
typedef struct 
{
    /* data */
    pEspConnect PespConnect;
    pEspEmergencyMeasure PespEmergencyMeasure;
    pEspUpLoadData PespUpLoadData;
    pEspConnectDeinit PespConnectDeinit;
    pEspEheckWifiRxBuff PespCheckWifiRxBuff;
    pEspReadWarnConfig PespReadWarnConfig;
}esp_t;
esp_t *espCreate(void);
#if ELECT
void WIFI_ResetIO_Init(void);
u8 ESP_Connect(void);
u8 parsingJsonDatafromApp(char *readyParsingData);
u8 emergencyMeasure(T_DATA data);
u8 upLoadData(T_DATA data);
u8 espConnectDeinit(void);
u8 checkWifiRxBuff(void);
void readwarnConfig(void);
void ESP_test(void);
#endif
#endif
